package com.compty.paint.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.compty.security.domain.User;


/**
 * @Todo:拍品基本信息
 * @CreateTime:2012-2-14 下午01:41:01
 */
@Entity
@Table(name = "t_bid")
public class Bid  implements java.io.Serializable {

	private static final long serialVersionUID = 4238836965065822019L;
	
	private Long id;
	
	private String title;
	
	private String paintingTitle;
	
	private Date uploadTime;
	
	private Date modifyTime;
	
	/************ 录入人  ****************/
	private User entryPerson;
	
	/************ 起拍价 ****************/
	private double beginPrice;
	
	/************ 成交价 ****************/
	private double knockDownPrice;
	
	/************ 拍卖状态：0：未开拍 1:拍卖中 2:已拍出 3:流拍  ****************/
	private Integer bid_status;
	private String bidStatus;//字符串表示
	
	/***********审核状态 0:未送审 1:审核中 2:审核通过 3:驳回*******************/
	private Integer audit_status;
	private String auditStatus;//字符串表示
	
	/***********显示状态  0:隐藏  1:显示  2:移除*******************/
	private Integer status;
	
	/************ 起始开拍时间 ****************/
	private Date beginTime;
	
	/************ 拍卖结束时间 ****************/
	private Date endTime;
	
	/************ 成交后生成订单 ****************/
	private Order order;
	
	private Integer goods_id;
	
	private Goods goods;
	
	private int bidCount;//出价次数
	
	private Long current_bidrecord_id;//当前出价记录ID
	private BidRecord currentBidRecord; //当前出价
	
	private String newFlag; //最新标志  1：最新  0:结束
	
	private Long painter_Id;//艺术家id
	
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "title",length = 100)
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "painting_title",length = 100)
	public String getPaintingTitle() {
		return paintingTitle;
	}

	public void setPaintingTitle(String paintingTitle) {
		this.paintingTitle = paintingTitle;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="userinfo_id")
	public User getEntryPerson() {
		return entryPerson;
	}

	public void setEntryPerson(User entryPerson) {
		this.entryPerson = entryPerson;
	}

	@Column(name = "uploadtime")
	public Date getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}

	@Column(name = "modifytime")
	public Date getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

	@Column(name = "knock_down_price")
	public double getKnockDownPrice() {
		return knockDownPrice;
	}

	public void setKnockDownPrice(double knockDownPrice) {
		this.knockDownPrice = knockDownPrice;
	}

	@Column(name = "begin_price")
	public double getBeginPrice() {
		return beginPrice;
	}

	public void setBeginPrice(double beginPrice) {
		this.beginPrice = beginPrice;
	}

	@Column(name = "begin_time")
	public Date getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	@Column(name = "end_time")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="order_id")
	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@Column( name = "goods_id" )
	public Integer getGoods_id() {
		return goods_id;
	}

	public void setGoods_id(Integer goodsId) {
		goods_id = goodsId;
	}

	@Transient
	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Column( name = "bid_status" )
	public Integer getBid_status() {
		return bid_status;
	}

	public void setBid_status(Integer bidStatus) {
		bid_status = bidStatus;
	}

	@Transient
	public String getBidStatus() {
		
		if( bid_status == 0 )bidStatus="未开拍";
		if( bid_status == 1 )bidStatus="拍卖中";
		if( bid_status == 2 )bidStatus="已拍出";
		if( bid_status == 3 )bidStatus="流拍";
		
		return bidStatus;
	}

	public void setBidStatus(String bidStatus) {
		this.bidStatus = bidStatus;
	}

	@Column( name = "audit_status")
	public Integer getAudit_status() {
		return audit_status;
	}

	public void setAudit_status(Integer auditStatus) {
		audit_status = auditStatus;
	}

	@Column( name = "bid_count")
	public int getBidCount() {
		return bidCount;
	}

	public void setBidCount(int bidCount) {
		this.bidCount = bidCount;
	}

	@Transient
	public String getAuditStatus() {
		
		if( audit_status == 0 ) auditStatus="未送审";
		if( audit_status == 1 ) auditStatus="审核中";
		if( audit_status == 2 ) auditStatus="通过";
		if( audit_status == 3 ) auditStatus="驳回";
		
		return auditStatus;
	}

	public void setAuditStatus(String auditStatus) {
		this.auditStatus = auditStatus;
	}

	@Column( name = "status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Transient
	public BidRecord getCurrentBidRecord() {
		return currentBidRecord;
	}

	public void setCurrentBidRecord(BidRecord currentBidRecord) {
		this.currentBidRecord = currentBidRecord;
	}

	@Transient
	public String getNewFlag() {
		return newFlag;
	}

	public void setNewFlag(String newFlag) {
		this.newFlag = newFlag;
	}

	@Column( name = "current_bidrecord_id")
	public Long getCurrent_bidrecord_id() {
		return current_bidrecord_id;
	}

	public void setCurrent_bidrecord_id(Long currentBidrecordId) {
		current_bidrecord_id = currentBidrecordId;
	}

	@Column( name = "painter_id")
	public Long getPainter_Id() {
		return painter_Id;
	}

	public void setPainter_Id(Long painterId) {
		painter_Id = painterId;
	}

}
